<template>
    <a-popconfirm :title="title" ok-text="确定" cancel-text="取消" @confirm="confirm" @cancel="cancel">
        <!-- 使用默认插槽 -->

            <slot name="button"></slot>
 
    </a-popconfirm>
</template>

<script lang="ts">
import { defineComponent} from 'vue';

export default defineComponent({
    name: 'Confirm',
    emits: ['confirm', 'cancel'],
    props: {
        title: {
            required: true,
            type: String
        }
    },
    setup(props, context) {

        const confirm = (e: MouseEvent) => {
            context.emit('confirm');
        };

        const cancel = (e: MouseEvent) => {
            context.emit('cancel');
        };

        return {
            confirm,
            cancel,
        };
    },
});

</script>